{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 命令行界面\n",
    "\n",
    "## 概览"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m                                                                                \u001b[0m\n",
      "\u001b[1m \u001b[0m\u001b[1;33mUsage: \u001b[0m\u001b[1mpxblat [OPTIONS] COMMAND [ARGS]...\u001b[0m\u001b[1m                                     \u001b[0m\u001b[1m \u001b[0m\n",
      "\u001b[1m                                                                                \u001b[0m\n",
      " \u001b[33m\u001b[1mVersion\u001b[0m: \u001b[32m\u001b[1m1.2.1\u001b[0m                                             \n",
      "                                                                                \n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Options \u001b[0m\u001b[2m───────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-install\u001b[0m\u001b[1;36m-completion\u001b[0m            Install completion for the current shell.    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-show\u001b[0m\u001b[1;36m-completion\u001b[0m               Show completion for the current shell, to    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                 copy it or customize the installation.       \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-help\u001b[0m                \u001b[1;32m-h\u001b[0m        Show this message and exit.                  \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Commands \u001b[0m\u001b[2m──────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36mclient     \u001b[0m\u001b[1;36m \u001b[0m A client for the genomic finding program that produces a .psl   \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m            \u001b[0m file.                                                           \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36mfatotwobit \u001b[0m\u001b[1;36m \u001b[0m Convert DNA from fasta to 2bit format.                          \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36mserver     \u001b[0m\u001b[1;36m \u001b[0m Make a server to quickly find where DNA occurs in genome        \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36mtwobittofa \u001b[0m\u001b[1;36m \u001b[0m Convert all or part of .2bit file to fasta.                     \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "                                                                                \n",
      " YangyangLi 2024 yangyang.li@northwstern.edu                                    \n",
      "                                                                                \n",
      "\n"
     ]
    }
   ],
   "source": [
    "!pxblat -h"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "支持的命令:\n",
    "\n",
    "- server:指定一个序列比对服务器\n",
    "- client:创建一个序列比对客户端,产生psl文件\n",
    "- fatotwobit:将fasta转换为2bit格式\n",
    "- twobittofa:将2bit转换为fasta格式\n",
    "\n",
    "通过输入`pxblat --install-completion`,可以为当前shell创建pxblat命令补全功能.\n",
    "\n",
    "## fatotwobit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m                                                                                \u001b[0m\n",
      "\u001b[1m \u001b[0m\u001b[1;33mUsage: \u001b[0m\u001b[1mpxblat fatotwobit [OPTIONS] in.fa [inf2.fa in3.fa ...] out.2bit\u001b[0m\u001b[1m        \u001b[0m\u001b[1m \u001b[0m\n",
      "\u001b[1m                                                                                \u001b[0m\n",
      " Convert DNA from fasta to 2bit format.                                         \n",
      "                                                                                \n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Arguments \u001b[0m\u001b[2m─────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    infa         \u001b[1;33min.fa [inf2.fa in3.fa ...\u001b[0m\u001b[1;2;33m]\u001b[0m  The fasta files \u001b[2;31m[required]\u001b[0m     \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    out2bit      \u001b[1;33mout.2bit                  \u001b[0m  The output file \u001b[2;31m[required]\u001b[0m     \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Options \u001b[0m\u001b[2m───────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-long\u001b[0m                    Use 64-bit offsets for index. Allow for twoBit to  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                           contain more than 4Gb of sequence.                 \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-nomask\u001b[0m                  Ignore lower-case masking in fa file.              \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-stripVersion\u001b[0m            Strip off version number after '.' for GenBank     \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                           accessions.                                        \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-ignoreDups\u001b[0m              Convert first sequence only if there are duplicate \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                           sequence names. Use 'twoBitDup' to find duplicate  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                           sequences.                                         \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-help\u001b[0m          \u001b[1;32m-h\u001b[0m        Show this message and exit.                        \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\n"
     ]
    }
   ],
   "source": [
    "!pxblat fatotwobit -h"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "fatotwobit支持的选项:\n",
    "\n",
    "- --long:使用64位索引,支持存储超过4Gb的序列\n",
    "- --nomask:忽略fa文件中的小写掩码\n",
    "- --stripVersion:去除`.`之后的版本号,方便GenBank新增\n",
    "- --ignoreDups:遇到重复的序列名,只转化第一个序列\n",
    "- --help/-h:显示帮助信息并退出\n",
    "\n",
    "fatotwobit命令示例:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "!pxblat fatotwobit data/test_ref.fa data/test_ref.2bit"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## twobittofa"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m                                                                                \u001b[0m\n",
      "\u001b[1m \u001b[0m\u001b[1;33mUsage: \u001b[0m\u001b[1mpxblat twobittofa [OPTIONS] input.2bit out.fa\u001b[0m\u001b[1m                          \u001b[0m\u001b[1m \u001b[0m\n",
      "\u001b[1m                                                                                \u001b[0m\n",
      " Convert all or part of .2bit file to fasta.                                    \n",
      "                                                                                \n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Arguments \u001b[0m\u001b[2m─────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    input2bit      \u001b[1;33minput.2bit\u001b[0m  The input 2bit file \u001b[2m[default: None]\u001b[0m          \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                 \u001b[2;31m[required]         \u001b[0m                          \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    outputfa       \u001b[1;33mout.fa    \u001b[0m  The output fasta file \u001b[2;31m[required]\u001b[0m             \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Options \u001b[0m\u001b[2m───────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-seq\u001b[0m              \u001b[1;33mTEXT   \u001b[0m  Restrict this to just one sequence.              \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-start\u001b[0m            \u001b[1;33mINTEGER\u001b[0m  Start at given position in sequence              \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                             (zero-based).                                    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                             \u001b[2m[default: 0]                                    \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-end\u001b[0m              \u001b[1;33mINTEGER\u001b[0m  End at given position in sequence                \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                             (non-inclusive).                                 \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                             \u001b[2m[default: 0]                                    \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-seqList\u001b[0m          \u001b[1;33mTEXT   \u001b[0m  File containing list of the desired sequence     \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                             names                                            \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-noMask\u001b[0m           \u001b[1;33m       \u001b[0m  Convert sequence to all upper case.              \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-bpt\u001b[0m              \u001b[1;33mTEXT   \u001b[0m  Use bpt index instead of built-in one.           \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-bed\u001b[0m              \u001b[1;33mTEXT   \u001b[0m  Grab sequences specified by input.bed.           \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-bedPos\u001b[0m           \u001b[1;33m       \u001b[0m  With \u001b[1;32m-bed\u001b[0m, use chrom:start-end as the fasta ID   \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                             in output.fa.                                    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-udcDir\u001b[0m           \u001b[1;33mTEXT   \u001b[0m  Place to put cache for remote bigBed/bigWigs.    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-help\u001b[0m     \u001b[1;32m-h\u001b[0m      \u001b[1;33m       \u001b[0m  Show this message and exit.                      \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\n"
     ]
    }
   ],
   "source": [
    "!pxblat twobittofa -h"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "twotobittofa支持的选项:\n",
    "\n",
    "- --seq:仅转化指定序列\n",
    "- --start:从指定索引位置开始转换[默认为0]\n",
    "- --end:在指定索引位置结束转换\n",
    "- --seqList:包含需要转换的一组序列名字的一个文件名\n",
    "- --noMask:全部转换序列为大写\n",
    "- --bpt:使用bpt索引而非默认索引\n",
    "- --bed:抓取`input.bed`中指定的序列\n",
    "- --bedPos:在指定--bed的情况下,使用chrom:start-end作为fasta ID\n",
    "- --udcDir:为远程bigBed/bigWigs存放缓存的路径\n",
    "- --help/-h:显示帮助信息并退出\n",
    "\n",
    "twotobittofa命令示例:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "!pxblat twobittofa data/test_ref.2bit data/test_ref_reverse.fa"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Server"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m                                                                                \u001b[0m\n",
      "\u001b[1m \u001b[0m\u001b[1;33mUsage: \u001b[0m\u001b[1mpxblat server [OPTIONS] COMMAND [ARGS]...\u001b[0m\u001b[1m                              \u001b[0m\u001b[1m \u001b[0m\n",
      "\u001b[1m                                                                                \u001b[0m\n",
      " Make a server to quickly find where DNA occurs in genome                       \n",
      "                                                                                \n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Options \u001b[0m\u001b[2m───────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-help\u001b[0m  \u001b[1;32m-h\u001b[0m        Show this message and exit.                                \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Commands \u001b[0m\u001b[2m──────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36mfiles  \u001b[0m\u001b[1;36m \u001b[0m To get input file list.                                             \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36mstart  \u001b[0m\u001b[1;36m \u001b[0m To set up a server.                                                 \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36mstatus \u001b[0m\u001b[1;36m \u001b[0m To figure out if server is alive, on static instances get usage     \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m        \u001b[0m statics.                                                            \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36mstop   \u001b[0m\u001b[1;36m \u001b[0m To remove a server.                                                 \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\n"
     ]
    }
   ],
   "source": [
    "!pxblat server -h"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Server命令支持选项:\n",
    "\n",
    "- files:输入文件列表\n",
    "- start:启动服务器\n",
    "- status:显示服务器状态\n",
    "- stop:停用服务器\n",
    "\n",
    "要启动一个服务器:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import os\n",
    "os.system('pxblat server start localhost 6500 data/test_ref.2bit &')#启动服务器将阻断其他命令,ipymol不支持后端运行,因此笔记中使用os.system+&的方式调用."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m                                                                                \u001b[0m\n",
      "\u001b[1m \u001b[0m\u001b[1;33mUsage: \u001b[0m\u001b[1mpxblat server start [OPTIONS] HOST PORT TWO_BIT\u001b[0m\u001b[1m                        \u001b[0m\u001b[1m \u001b[0m\n",
      "\u001b[1m                                                                                \u001b[0m\n",
      " To set up a server.                                                            \n",
      " \u001b[2mgfServer start host port file(s)\u001b[0m                                               \n",
      " \u001b[2mwhere the files are .2bit or .nib format files specified relative to the \u001b[0m      \n",
      " \u001b[2mcurrent directory\u001b[0m                                                              \n",
      "                                                                                \n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Arguments \u001b[0m\u001b[2m─────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    host         \u001b[1;33mTEXT   \u001b[0m  \u001b[2m[default: None]\u001b[0m \u001b[2;31m[required]\u001b[0m                        \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    port         \u001b[1;33mINTEGER\u001b[0m  \u001b[2m[default: None]\u001b[0m \u001b[2;31m[required]\u001b[0m                        \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    two_bit      \u001b[1;33mFILE   \u001b[0m  Two bit file \u001b[2m[default: None]\u001b[0m \u001b[2;31m[required]\u001b[0m           \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Options \u001b[0m\u001b[2m───────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-tile\u001b[0m\u001b[1;36m-size\u001b[0m              \u001b[1;33mINTEGER\u001b[0m  Size of n-mers to index.  Default is 11    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   for nucleotides, 4 for proteins (or        \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   translated nucleotides).                   \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: 11]                             \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-stepSize\u001b[0m               \u001b[1;33mINTEGER\u001b[0m  Spacing between tiles. Default is          \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   tileSize.                                  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: 11]                             \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-min\u001b[0m\u001b[1;36m-match\u001b[0m              \u001b[1;33mINTEGER\u001b[0m  Number of n-mer matches that trigger       \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   detailed alignment. Default is 2 for       \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   nucleotides, 3 for proteins.               \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: 2]                              \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-trans\u001b[0m                  \u001b[1;33m       \u001b[0m  Translate database to protein in 6 frames. \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-log\u001b[0m                    \u001b[1;33mTEXT   \u001b[0m  Keep a log file that records server        \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   requests.                                  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: None]                           \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-mask\u001b[0m                   \u001b[1;33m       \u001b[0m  Use masking from .2bit file.               \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-repMatch\u001b[0m               \u001b[1;33mINTEGER\u001b[0m  Number of occurrences of a tile (n-mer)    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   that triggers repeat masking the tile.     \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   Default is 1024.                           \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: 0]                              \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-noSimpRepMask\u001b[0m          \u001b[1;33m       \u001b[0m  Suppresses simple repeat masking.          \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-maxDnaHits\u001b[0m             \u001b[1;33mINTEGER\u001b[0m  Maximum number of hits for a DNA query     \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   that are sent from the server.             \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: 100]                            \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-maxTransHits\u001b[0m           \u001b[1;33mINTEGER\u001b[0m  Maximum number of hits for a translated    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   query that are sent from the server.       \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: 200]                            \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-maxNtSize\u001b[0m              \u001b[1;33mINTEGER\u001b[0m  Maximum size of untranslated DNA query     \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   sequence.                                  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: 40000]                          \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-perSeqMax\u001b[0m              \u001b[1;33mFILE   \u001b[0m  File contains one seq filename (possibly   \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   with ':seq' suffix) per line.              \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: None]                           \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-canStop\u001b[0m                \u001b[1;33m       \u001b[0m  If set, a quit message will actually take  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   down the server.                           \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-indexFile\u001b[0m              \u001b[1;33mFILE   \u001b[0m  Index file create by `gfServer index'.     \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: None]                       \u001b[0m     \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-timeout\u001b[0m                \u001b[1;33mINTEGER\u001b[0m  Timeout in seconds. \u001b[2m[default: 90]\u001b[0m          \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-help\u001b[0m           \u001b[1;32m-h\u001b[0m      \u001b[1;33m       \u001b[0m  Show this message and exit.                \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\n"
     ]
    }
   ],
   "source": [
    "!pxblat server start -h"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "要从运行中的服务器获取输入文件列表:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m[\u001b[0m\u001b[32m'data/test_ref.2bit'\u001b[0m\u001b[1m]\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "!pxblat server files localhost 6500"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m                                                                                \u001b[0m\n",
      "\u001b[1m \u001b[0m\u001b[1;33mUsage: \u001b[0m\u001b[1mpxblat server files [OPTIONS] HOST PORT\u001b[0m\u001b[1m                                \u001b[0m\u001b[1m \u001b[0m\n",
      "\u001b[1m                                                                                \u001b[0m\n",
      " To get input file list.                                                        \n",
      "                                                                                \n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Arguments \u001b[0m\u001b[2m─────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    host      \u001b[1;33mTEXT   \u001b[0m  \u001b[2m[default: None]\u001b[0m \u001b[2;31m[required]\u001b[0m                           \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    port      \u001b[1;33mINTEGER\u001b[0m  \u001b[2m[default: None]\u001b[0m \u001b[2;31m[required]\u001b[0m                           \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Options \u001b[0m\u001b[2m───────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-help\u001b[0m  \u001b[1;32m-h\u001b[0m        Show this message and exit.                                \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\n"
     ]
    }
   ],
   "source": [
    "!pxblat server files -h"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "要检查服务器的状态:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m{\u001b[0m\n",
      "    \u001b[32m'version'\u001b[0m: \u001b[32m'37x1'\u001b[0m,\n",
      "    \u001b[32m'serverType'\u001b[0m: \u001b[32m'static'\u001b[0m,\n",
      "    \u001b[32m'type'\u001b[0m: \u001b[32m'nucleotide'\u001b[0m,\n",
      "    \u001b[32m'host'\u001b[0m: \u001b[32m'localhost'\u001b[0m,\n",
      "    \u001b[32m'port'\u001b[0m: \u001b[32m'6500'\u001b[0m,\n",
      "    \u001b[32m'tileSize'\u001b[0m: \u001b[32m'11'\u001b[0m,\n",
      "    \u001b[32m'stepSize'\u001b[0m: \u001b[32m'11'\u001b[0m,\n",
      "    \u001b[32m'minMatch'\u001b[0m: \u001b[32m'2'\u001b[0m,\n",
      "    \u001b[32m'pcr requests'\u001b[0m: \u001b[32m'0'\u001b[0m,\n",
      "    \u001b[32m'blat requests'\u001b[0m: \u001b[32m'0'\u001b[0m,\n",
      "    \u001b[32m'bases'\u001b[0m: \u001b[32m'0'\u001b[0m,\n",
      "    \u001b[32m'misses'\u001b[0m: \u001b[32m'0'\u001b[0m,\n",
      "    \u001b[32m'noSig'\u001b[0m: \u001b[32m'0'\u001b[0m,\n",
      "    \u001b[32m'trimmed'\u001b[0m: \u001b[32m'0'\u001b[0m,\n",
      "    \u001b[32m'warnings'\u001b[0m: \u001b[32m'0'\u001b[0m\n",
      "\u001b[1m}\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "!pxblat server status localhost 6500"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m                                                                                \u001b[0m\n",
      "\u001b[1m \u001b[0m\u001b[1;33mUsage: \u001b[0m\u001b[1mpxblat server status [OPTIONS] HOST PORT\u001b[0m\u001b[1m                               \u001b[0m\u001b[1m \u001b[0m\n",
      "\u001b[1m                                                                                \u001b[0m\n",
      " To figure out if server is alive, on static instances get usage statics.       \n",
      "                                                                                \n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Arguments \u001b[0m\u001b[2m─────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    host      \u001b[1;33mTEXT   \u001b[0m  \u001b[2m[default: None]\u001b[0m \u001b[2;31m[required]\u001b[0m                           \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    port      \u001b[1;33mINTEGER\u001b[0m  \u001b[2m[default: None]\u001b[0m \u001b[2;31m[required]\u001b[0m                           \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Options \u001b[0m\u001b[2m───────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-trans\u001b[0m            Translate database to protein in 6 frames.                \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-help\u001b[0m   \u001b[1;32m-h\u001b[0m        Show this message and exit.                               \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\n"
     ]
    }
   ],
   "source": [
    "!pxblat server status -h"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "要停止服务器:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[32mServer localhost:\u001b[0m\u001b[1;32m6500\u001b[0m\u001b[32m stopped\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "!pxblat server stop localhost 6500"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m                                                                                \u001b[0m\n",
      "\u001b[1m \u001b[0m\u001b[1;33mUsage: \u001b[0m\u001b[1mpxblat server stop [OPTIONS] HOST PORT\u001b[0m\u001b[1m                                 \u001b[0m\u001b[1m \u001b[0m\n",
      "\u001b[1m                                                                                \u001b[0m\n",
      " To remove a server.                                                            \n",
      "                                                                                \n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Arguments \u001b[0m\u001b[2m─────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    host      \u001b[1;33mTEXT   \u001b[0m  \u001b[2m[default: None]\u001b[0m \u001b[2;31m[required]\u001b[0m                           \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    port      \u001b[1;33mINTEGER\u001b[0m  \u001b[2m[default: None]\u001b[0m \u001b[2;31m[required]\u001b[0m                           \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Options \u001b[0m\u001b[2m───────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-help\u001b[0m  \u001b[1;32m-h\u001b[0m        Show this message and exit.                                \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\n"
     ]
    }
   ],
   "source": [
    "!pxblat server stop -h"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Client\n",
    "\n",
    "要进行客户端查询:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os \n",
    "os.system('pxblat server start localhost 6500 data/test_ref.2bit &')# 客户端要发送请求,服务端必须首先处于运行状态\n",
    "!pxblat client localhost 6500 data data/test_case1.fa data/out.psl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m                                                                                \u001b[0m\n",
      "\u001b[1m \u001b[0m\u001b[1;33mUsage: \u001b[0m\u001b[1mpxblat client [OPTIONS] HOST PORT SEQDIR INFASTA OUTPSL\u001b[0m\u001b[1m                \u001b[0m\u001b[1m \u001b[0m\n",
      "\u001b[1m                                                                                \u001b[0m\n",
      " A client for the genomic finding program that produces a .psl file.            \n",
      "                                                                                \n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Arguments \u001b[0m\u001b[2m─────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    host         \u001b[1;33mTEXT   \u001b[0m  The name of the machine running the gfServer      \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                            \u001b[2m[default: None]                             \u001b[0m      \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                            \u001b[2;31m[required]                                  \u001b[0m      \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    port         \u001b[1;33mINTEGER\u001b[0m  The same port that you started the gfServer with  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                            \u001b[2m[default: None]                                 \u001b[0m  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                            \u001b[2;31m[required]                                      \u001b[0m  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    seqdir       \u001b[1;33mPATH   \u001b[0m  The path of the .2bit or .nib files relative to   \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                            the current dir                                   \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                            \u001b[2m[default: None]                                  \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                            \u001b[2;31m[required]                                       \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    infasta      \u001b[1;33mPATH   \u001b[0m  Fasta format file.  May contain multiple records  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                            \u001b[2m[default: None]                                 \u001b[0m  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                            \u001b[2;31m[required]                                      \u001b[0m  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[31m*\u001b[0m    outpsl       \u001b[1;33mPATH   \u001b[0m  where to put the output \u001b[2m[default: None]\u001b[0m           \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                            \u001b[2;31m[required]             \u001b[0m                           \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\u001b[2m╭─\u001b[0m\u001b[2m Options \u001b[0m\u001b[2m───────────────────────────────────────────────────────────────────\u001b[0m\u001b[2m─╮\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-type\u001b[0m           \u001b[1;32m-t\u001b[0m      \u001b[1;33mTEXT   \u001b[0m  Database type. Type is one of: dna, prot,  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   dnax                                       \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: dna]                            \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-qtype\u001b[0m          \u001b[1;32m-q\u001b[0m      \u001b[1;33mTEXT   \u001b[0m  Query type. Type is one of: dna, rna,      \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   prot, dnax, rnax                           \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: dna]                            \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-prot\u001b[0m                   \u001b[1;33m       \u001b[0m  Synonymous with \u001b[1;32m-t\u001b[0m=prot \u001b[1;32m-q\u001b[0m=prot.           \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-dots\u001b[0m                   \u001b[1;33mINTEGER\u001b[0m  Output a dot every N query sequences.      \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: 0]                         \u001b[0m      \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-nohead\u001b[0m                 \u001b[1;33m       \u001b[0m  Suppresses 5-line psl header.              \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-minScore\u001b[0m               \u001b[1;33mINTEGER\u001b[0m  Sets minimum score.  This is twice the     \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   matches minus the mismatches minus some    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   sort of gap penalty.  Default is 30.       \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: 30]                             \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-minIdentity\u001b[0m            \u001b[1;33mINTEGER\u001b[0m  Sets minimum sequence identity (in         \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   percent).  Default is 90 for nucleotide    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   searches, 25 for protein or translated     \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   protein searches.                          \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: 90.0]                           \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-out\u001b[0m                    \u001b[1;33mTEXT   \u001b[0m  Controls output file format.  Type is one  \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   of: psl, pslx, axt, maf, sim4, wublast,    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   blast, blast8, blast9                      \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: psl]                            \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-maxIntron\u001b[0m              \u001b[1;33mINTEGER\u001b[0m  Sets maximum intron size. Default is       \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   750000.                                    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m                                   \u001b[2m[default: 750000]                         \u001b[0m \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-genome\u001b[0m                 \u001b[1;33mTEXT   \u001b[0m  dynamic                                    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-genomeDataDir\u001b[0m          \u001b[1;33mTEXT   \u001b[0m  dynamic                                    \u001b[2m│\u001b[0m\n",
      "\u001b[2m│\u001b[0m \u001b[1;36m-\u001b[0m\u001b[1;36m-help\u001b[0m           \u001b[1;32m-h\u001b[0m      \u001b[1;33m       \u001b[0m  Show this message and exit.                \u001b[2m│\u001b[0m\n",
      "\u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
      "\n"
     ]
    }
   ],
   "source": [
    "!pxblat client -h"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "psLayout version 3\n",
      "\n",
      "match\tmis- \trep. \tN's\tQ gap\tQ gap\tT gap\tT gap\tstrand\tQ        \tQ   \tQ    \tQ  \tT        \tT   \tT    \tT  \tblock\tblockSizes \tqStarts\t tStarts\n",
      "     \tmatch\tmatch\t   \tcount\tbases\tcount\tbases\t      \tname     \tsize\tstart\tend\tname     \tsize\tstart\tend\tcount\n",
      "---------------------------------------------------------------------------------------------------------------------------------------------------------------\n",
      "151\t0\t0\t0\t0\t0\t0\t0\t+\tcase1\t151\t0\t151\tchr1\t14999\t12699\t12850\t1\t151,\t0,\t12699,\n"
     ]
    }
   ],
   "source": [
    "!cat data/out.psl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[32mServer localhost:\u001b[0m\u001b[1;32m6500\u001b[0m\u001b[32m stopped\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "!pxblat server stop localhost 6500\n",
    "!rm data/out.psl data/test_ref_reverse.fa data/test_ref.2bit"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "cctbx",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
